import request from '@/config/axios'

// 功能模块 VO
export interface ProjectCellVO {
  id: number // 菜单ID
  name: string // 功能名称
  sort: number // 显示顺序
  parentId: number // 父菜单ID
  context: string // 需求分解内容
  sqlText: string // 建表sql
}

// 功能模块 API
export const ProjectCellApi = {
  // 查询功能模块列表
  getProjectCellList: async (params) => {
    return await request.get({url: `/agent/project-cell/list`, params})
  },

  // 查询功能模块详情
  getProjectCell: async (id: number) => {
    return await request.get({url: `/agent/project-cell/get?id=` + id})
  },

  // 新增功能模块
  createProjectCell: async (data: ProjectCellVO) => {
    return await request.post({url: `/agent/project-cell/create`, data})
  },

  // 修改功能模块
  updateProjectCell: async (data: ProjectCellVO) => {
    return await request.put({url: `/agent/project-cell/update`, data})
  },

  // 删除功能模块
  deleteProjectCell: async (id: number) => {
    return await request.delete({url: `/agent/project-cell/delete?id=` + id})
  },

  // 导出功能模块 Excel
  exportProjectCell: async (params) => {
    return await request.download({url: `/agent/project-cell/export-excel`, params})
  },
  
  // 提取数据表
  extractTable: async (id: number) => {
    return await request.post({url: `/agent/project-cell/extract-table?id=` + id})
  },
}
